Skip to content

fix: close leaked fd on concurrent handle reopen race and remap fh_out#550

Closed
claude-claude[bot] wants to merge 1 commit intofuse-pipe-restorefrom
claude/fix-22646260749
Closed

fix: close leaked fd on concurrent handle reopen race and remap fh_out#550
claude-claude[bot] wants to merge 1 commit intofuse-pipe-restorefrom
claude/fix-22646260749

Conversation

@claude-claude
Copy link
Copy Markdown
Contributor

@claude-claude claude-claude bot commented Mar 3, 2026

Auto-Fix for PR #549

Issues Fixed

  1. [MEDIUM] File descriptor leak on concurrent handle reopen race — When two threads race to reopen the same stale handle in try_reopen_handle, the losing thread's newly opened fd was never released. Now the loser sends Release/Releasedir to the inner handler to close the orphaned fd.

  2. [MEDIUM] Incomplete fh_out remapping for CopyFileRange/RemapFileRange — Added fh_out(), ino_out(), and with_fh_out() protocol helpers. The stale-handle recovery path now remaps both fh_in and fh_out, matching the existing remap_request_inodes which already handles both ino_in and ino_out.

  3. [LOW] Misleading log field name — Changed entries = json.len() to bytes = json.len() since serialize_table() returns a String and .len() is byte count, not entry count.

  4. [LOW] Copy-paste doc comment — Fixed test doc comment that incorrectly referenced --non-blocking-output instead of describing the snapshot restore test.

Changes

  • fuse-pipe/src/server/remap.rs: Release orphaned fd in try_reopen_handle race loser path; remap fh_out in handle translation and EBADF retry
  • fuse-pipe/src/protocol/request.rs: Add fh_out(), ino_out(), with_fh_out() helpers
  • src/commands/podman/snapshot.rs: Fix log field name
  • tests/test_portable_volumes.rs: Fix doc comment

Generated by Claude | Review Run

- In try_reopen_handle, when two threads race to reopen the same stale
  handle, the losing thread's newly opened fd was leaked. Now the loser
  sends Release/Releasedir to the inner handler to close the orphaned fd.

- Add fh_out(), ino_out(), with_fh_out() protocol helpers so
  CopyFileRange/RemapFileRange stale-handle recovery remaps both fh_in
  and fh_out (previously only fh_in was remapped).

- Fix misleading log field: entries -> bytes (json.len() is byte count).

- Fix copy-paste doc comment on test_open_handle_survives_snapshot_restore.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ejc3
Copy link
Copy Markdown
Owner

ejc3 commented Mar 3, 2026

Fixing manually in the main PR

@ejc3 ejc3 closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant